<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>&lt; &#x3000;</div>
    <script>
        var str = "qwertyuiop";
        // var res = str.charAt(3);
        // console.log(res); //r

        console.log(str[3]); //r

        res = str.includes("ert"); //是否包含
        console.log(res); true
        res = str.startsWith("qwert"); //是否以参数开头
        console.log(res); //
        res = str.endsWith("p"); //是否以参数结尾
        console.log(res); 

        // 这三个方法都是只写一个参数的话 就从第n开始截取到最后
        res = str.slice(2,3); //从n到m 包括n不包过m
        console.log(res);  //
        res = str.substr(2,3); //从n要m个
        console.log(res); //
        res = str.substring(2,3);//从n到m 包括n不包过m
        console.log(res); //


        res = str.split();
        console.log(res);
        res = str.split("");
        console.log(res);
        res = str.split("y");
        console.log(res);

        str = "     str      ";
        console.log(str);
        res = str.trim();
        console.log(res);
        res = str.trimStart();  
        console.log(res);
        res = str.trimEnd();
        console.log(res);


        str = "asdfghjkl";
        res = str.toLocaleUpperCase();
        console.log(res);
        res = str.toLocaleLowerCase();
        console.log(res);

        
        for(var key of str){
            console.log(key);
        }
        // for in 循环str和arr的时候得到的是索引值
        for(var key in str){
            console.log(key);
        }
    </script>
</body>
</html>